using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ApiTest.Api.Utils
{
 public class JsonHelper
 {
     public static  string Serialize(dynamic obj)
     {      //时间格式
            var datetimeFormat="yyyy-MM-dd HH:mm:ss";
            //小写转换驼峰式 
            
            var setting=new JsonSerializerSettings();
            setting.ContractResolver=new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
            setting.DateFormatString=datetimeFormat;
            
            //时间
            var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeFormat };
            var result=JsonConvert.SerializeObject(obj, Formatting.Indented, setting);
            return result;
     }
 }   
}